import 'package:cook_dinner/config/include.dart';
import 'package:flutter/material.dart';

class OrderItem extends StatelessWidget {
  const OrderItem({Key? key, this.text, this.tab}) : super(key: key);

  final String? text;
  final int? tab;

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      padding: EdgeInsets.only(
        top: 12.rpx,
        left: 21.rpx,
        right: 24.rpx,
        bottom: 11.rpx,
      ),
      margin: EdgeInsets.only(bottom: 36.rpx),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(30.rpx),
        color: Colors.white,
      ),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  Text(
                    tab == 1 ? '猪肉贩卖铺' : '订单编号：273748737262834',
                    style: TextStyle(
                      color: const Color(0xff19140E),
                      fontSize: 13.rpx,
                    ),
                  ),
                  SizedBox(width: 6.rpx),
                  tab == 1
                      ? Image.asset('assets/images/right_icon.png',
                          height: 15.rpx)
                      : const SizedBox.shrink()
                ],
              ),
              Text(
                text ?? '已收货',
                style: TextStyle(
                  color: const Color(0xffFA8303),
                  fontSize: 13.rpx,
                ),
              )
            ],
          ),
          SizedBox(height: 20.rpx),
          Row(
            children: [
              ClipRRect(
                borderRadius: BorderRadius.circular(11.rpx),
                child: Image.asset(
                  'assets/images/pork.png',
                  width: 68.rpx,
                  height: 68.rpx,
                ),
              ),
              SizedBox(width: 12.rpx),
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      '猪肉排骨肋骨猪肉排骨肋骨猪肉排骨肋骨猪肉排骨肋骨',
                      style: TextStyle(
                        color: const Color(0xff19140E),
                        fontSize: 13.rpx,
                      ),
                    ),
                    SizedBox(height: 15.rpx),
                    Text(
                      '2份 / 1kg',
                      style: TextStyle(
                        color: const Color(0xffA7A5A5),
                        fontSize: 13.rpx,
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
          SizedBox(height: 5.rpx),
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              Text(
                '2件商品共：',
                style: TextStyle(
                  color: const Color(0xff19140E),
                  fontSize: 14.rpx,
                ),
              ),
              SizedBox(height: 15.rpx),
              Text(
                '¥ 128.00',
                style: TextStyle(
                  color: const Color(0xffFA8303),
                  fontSize: 14.rpx,
                ),
              ),
            ],
          ),
          SizedBox(height: 12.rpx),
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              tab == 1
                  ? Container(
                      width: 64.rpx,
                      height: 24.rpx,
                      margin: EdgeInsets.only(right: 22.rpx),
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        border: Border.all(
                            color: const Color(0xff19140E), width: 1.rpx),
                        borderRadius: BorderRadius.circular(12.rpx),
                      ),
                      child: Text(
                        '取消订单',
                        style: TextStyle(
                          color: const Color(0xff19140E),
                          fontSize: 10.rpx,
                        ),
                      ),
                    )
                  : const SizedBox(),
              Container(
                width: 64.rpx,
                height: 24.rpx,
                margin: EdgeInsets.only(right: 22.rpx),
                alignment: Alignment.center,
                decoration: BoxDecoration(
                  border:
                      Border.all(color: const Color(0xff19140E), width: 1.rpx),
                  borderRadius: BorderRadius.circular(12.rpx),
                ),
                child: Text(
                  tab == 1 ? '修改信息' : '删除',
                  style: TextStyle(
                    color: const Color(0xff19140E),
                    fontSize: 10.rpx,
                  ),
                ),
              ),
              Container(
                width: 64.rpx,
                height: 24.rpx,
                alignment: Alignment.center,
                decoration: BoxDecoration(
                  border:
                      Border.all(color: const Color(0xffFA8303), width: 1.rpx),
                  borderRadius: BorderRadius.circular(12.rpx),
                ),
                child: Text(
                  tab == 1 ? '继续付款' : '评价',
                  style: TextStyle(
                    color: const Color(0xffFA8303),
                    fontSize: 10.rpx,
                  ),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
